<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html" 
	xmlns:r="http://richfaces.org/rich" 
	xmlns:a="http://richfaces.org/a4j"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:ad="http://agiledev.com.br/fieldset">
	
	<ui:component>
	
		<h:form id="fSR">
	
			<s:decorate template="/layout/comands.xhtml">
				<a:commandButton value="#{messages.gravar}" actionListener="#{mb.persistScrumRole}" data="#{eventContext.get('controle')}" reRender="#{rr},fSR" oncomplete="if(data == 'sucesso'){Richfaces.hideModalPanel('mpSR');}"/>
				<h:outputText value=" " />
				<a:commandButton value="#{messages.excluir}" actionListener="#{mb.removeScrumRole}" data="#{eventContext.get('controle')}" reRender="#{rr},fSR" rendered="#{not empty ent.oid}" oncomplete="if(data == 'sucesso'){Richfaces.hideModalPanel('mpSR');}"/>
			</s:decorate>
			
			<ad:fieldset id="fsSR" legenda="#{messages.team}">
			
				<h:inputHidden id="ihOid" value="#{ent.user.oid}" />
				
				<s:decorate id="dUser" template="/layout/edit.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.usuario}" />
					</ui:define>
					<h:inputText id="user" value="#{ent.user.nome}" size="50" maxlength="100" required="true"/> 
				</s:decorate>

				<r:suggestionbox id="sbUser" for="user" suggestionAction="#{userSugestionMB.autocomplete}" var="user" 
					nothingLabel="#{messages.msgRegistroNaoEncontrado}" fetchValue="#{user.descricao}" minChars="2" 
					limitToList="true" usingSuggestObjects="true" width="400" onobjectchange="setDadosSB(suggestion, 'fSR:ihOid', 'fSR:dUser:sbUser')">

 					<h:column>
                        <h:outputText value="#{user.descricao}" />
                    </h:column>
                    <h:column>
                        <h:outputText value="#{user.nome}" />
                    </h:column>
				</r:suggestionbox>

				<s:decorate	id="dTipo" template="/layout/edit.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.role}" />
					</ui:define>
									
					<h:selectOneMenu id="tipo" value="#{ent.type}" required="true">
						<s:convertEnum />
						<s:enumItem enumValue="scrumTeam" label="#{messages.scrumTeam}"/>
						<s:enumItem enumValue="scrumMaster" label="#{messages.scrumMaster}"/>
						<s:enumItem enumValue="productOwner" label="#{messages.productOwner}" />
					</h:selectOneMenu>
				</s:decorate>
		
			</ad:fieldset>	
	
		</h:form>
	</ui:component>
</html>
